package com.admin.education.controllers.business;

import com.admin.education.common.jwt.JwtAuthorize;
import com.admin.education.common.response.IResponseMessage;
import com.admin.education.common.response.ResponseMessageWithData;
import com.admin.education.common.response.Result;
import com.admin.education.models.Enum.QuestionType;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;

@JwtAuthorize
@RestController
@RequestMapping("questionTypes")
@CrossOrigin(origins = "*", maxAge = 3600)
public class QuestionTypeController {
    @GetMapping("")
    public Callable<IResponseMessage> queryQuestionTypes(){
        return  new Callable<IResponseMessage>() {
            @Override
            public IResponseMessage call() throws Exception {
                List<String> datas= new ArrayList<>();
                for(QuestionType status :QuestionType.values()){
                    datas.add(status.toString());
                }
                IResponseMessage responseMessage = new ResponseMessageWithData<List<String>>(Result.Success,datas);
                return responseMessage;
            }
        };
    }
}
